~4Dgifts/toolbox/src/exampleCode/irix/tools README contains the beginnings of an irix tools subtree of programs relevant to unix/system programming. Lastrev collects information about the revisions and symbols defined in RCS files and then prints this information. Synopsis: Lastrev [-bl] [[-a] -s <symbol>] { <file-list> | <directory> } -a Print all files even if symbol not defined -b Print base revision number for each symbol -t Do not print title lines ------------------------------ chktime Compares two files modification times and returns -1, 0 or +1 depending on whether the first file was modified before, at the same time or after the second file. Synopsis: chktime [-d] [-r] <source-file> <object-file | executable-file> Description: The purpose of this routine is to determine if a particular source file needs to be recompiled. For developer's not using the features of make to determine this need, this routine had to be written. chktime can also be used to determine if a file is newer than some other file. For example, if you want to copy all the new files to a tape, you can use chktime to compare files to some "reference file" and only tar those that are newer (or older). The functions performed by chktime are as follows: 1. If -r option given, skip to step 3. 2. If the source file exists in the current directory: a. Set MODTIM to the last modified time of the file. b. Skip to step 5. 3. If the source file does not exist in ./RCS as an RCS file, exit with an error message. 4. Set MODTIM to the last modified time of the latest revision in the RCS file. 5. If MODTIM is less than or equal to the modification time of the object file, return with a -1 or 0. 6. Return with status of 1. The option -d will enable debug output. ------------------------------ getopt Enhanced version of the getopt command provided with Unix. Synopsis: getopt [-o <name>] <optstring> <options> Description: Identical to the system 'getopt' command except that it has the additional functions: 1. If the -o option is provided, checks a file called .getopt for a line that begins with <name>. It then uses the options provided on this line as defaults. 2. Normally, the option string contains letters and, optionally, colons to indicate that an option must be followed by an argument. In addition, we allow a '=' to indicate that an option might be followed immediately by an argument (with no white space), a '+' to indicate that an option might be followed by an argument (with white space). ------------------------------ gettime Gets the last modification time of the file and writes it to stdout. Synopsis: gettime [-d] [-i] [-c | -m | -a] [[+<format>] <file>] [[+<format>] \ <file>] ... Description: This routine writes to stdout the file time for the file(s) specified. If -c is specified, the creation time is written; -m for modification time and -a for access time. Modification time is assumed. If format is specified, it will display the time for all the following files (until another format is specified) in the format given. Otherwise, the date and time will be printed according to the default of ctime(3C). Format is defined the same way as for the date(1) command except the '%' sign is not required. For example, to get the julian date for a file, the command 'gettime "+j" <file>' will return this date. The -d option enables debug printout. The -i option overrides any format(s) provided and prints the date in integer format. This is useful when comparing the time of two files in shell scripts. ------------------------------ gpasswd identical to passwd except it sets the password for a group in the /etc/group file. Format of call: gpasswd [group] Where: group Is an optional group name to change. The user must be in the list of users allowed to be in the group to change the group password. If 'group' is not specified, the user's current group will be assumed. Features: - If user is root, does not ask for current password. - If no password exists yet, does not ask for current password. - If YP entry, keeps it a YP entry. Discussion: This is just some discussion on how the group password works and how groups are used in UNIX. If the user needs the privileges of a group other than their default group, the user can use the 'newgrp' command. If the user is root or in the list in /etc/group for the new group, newgrp starts a new shell (using whatever shell is the default shell) having the new group as its group ID. Note: To return to the old group, all one has to do is exit the current shell. If the user is not in the list of accepted users for a group, newgrp will ask for a password (if one exists for that group in /etc/group). If no password exists and the user is not in the list, newgrp will not allow the change. If a password is present and the user enters it correctly, newgrp will start a new shell having the new group as its group ID. This mechanism provides a means by which to set the password for a group. UNIX provides no other mechanism for doing this. This feature also provides a form of control over who has certain group privileges. ------------------------------ isIn returns true/false indication if the first parameter is equal to any of the other parameters on the command line. Useful in shell scripts to find out if a directory is already in the path or a host is in a list of hosts, etc. ------------------------------ listWMres lists all the resources known to the window manager. This tells you what resources have been set in the .Xresources and any merged resources added afterwards with xrdb. ------------------------------ printf does the same thing as the printf command in C but as a command in a shell script. Better than the one provided with IRIX 5.x because it can handle all the standard C types (integers, floating point, etc.). ------------------------------ rcstime returns the time of the last checked in revision of an RCS file (or the time of the specified revision). If the -i option is used (to return the time in decimal), the number can be used to compare in shell scripts. Synopsis: rcstime [+<format>] [-i] [-R] [-r<rev>] file [[-r<rev>] files...] Description: This program writes to stdout the time of the last update found in the RCS file. The program uses the same search sequence for the RCS file as the standard RCS programs (co, ci, rcs). For information on how it finds the RCS file, see below under File Search Method. The -r<rev> option identifies which revision from the RCS file is to be used in computing the modification time. If just -r is given (with no <rev>), the latest known revision is selected. The +<format> option provides a format that is to be used in writing the time. This format is identical to the date(1) command. The -i option overrides any format provided and prints the date in integer format. The -R option specifies that the actual revision number that was found should also be printed. File Search Method: If the file name ends in ",v", it is take to be an RCS file. All other files are assumed to be working files and the names are converted be RCS files. If no path is provided, the RCS file is looked for in the directory ./RCS and then in the current directory. If a path is provided, the RCS file is looked for only in the directory provided. ------------------------------ strlen does the same thing as the strlen command in C by returning the length of the string provided on the command line. strlen allows a shell program to count the number of characters in a string. Assuming it was reading a file or input of some sort, it can determine how many characters are in a word or line. There is no way to do this from within a shell script. ------------------------------ unique returns all the parameters passed on the command line removing any duplicates. Thus, if you have a line like 'set path = ( $path ... )' in your .cshrc or .login files and you execute these files more than once (which some people do), the unique command will remove path elements that get duplicated. ------------------------------ vacupd reads and modifies data in the vacation database files. Format of call: vacupd Discussion: This program allows the user to print, remove and add names to the vacation database. This database is generated by the 'vacation(1)' command and is used to determine which mail users and aliases to send vacation messages to. When a user is going on vacation, they frequently want people who send them mail to be aware that they won't get a reply until the user returns from vacation. To do this, the user runs the vacation(1) program and creates a .vacation.msg file with the text they want sent to other people to inform them that the user is on vacation. Many times, the user is on a large distribution list and, when the vacation program replies with the vacation message, all the people on the distribution list gets the vacation message. This is usually undesirable but, until now, there was no way of stopping it from happening. With this program, before the user actually goes on vacation and before they forward their mail to be intercepted by the vacation program but after initializing the vacation database, the user can view what default values are set up in the database and they can add specific aliases or users to the database so they won't get the vacation message. The program should be run in the user's home directory (where the .vacation* files reside). The program expects these files to exist in the current directory, thus allowing the user to copy these files to another directory and modify them or look at the copies without affecting the ones actually used. Running the program brings up a little menu of functions that can be performed. When initializing the database, one of the options is the interval between sending messages to users. Thus, after the first message to "Jane Doe", Jane won't get another vacation message for <interval> days, no matter how many pieces of mail she sends to the user. By default, when a user name (or alias) is added, this interval is used to initialize the user's entry. When adding an 'ignored' user, a big interval is used to initialize the entry, which should be a number of years. Removing a user will make it so they receive a vacation message the first time they send a message. Print will print everything in the database so far. This command is useful after the owner returns from vacation to find out who has sent mail while they were gone.
Source
Documentation
Reference